package com.wuwei.elearning.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ConversionMessage implements Serializable {
    private static final long serialVersionUID = 1L;

    private String fileName;
    private Long id;
    private String minioPath; // 新增字段，存储MinIO中的路径

    public ConversionMessage(String topic, Object payload, LocalDateTime scheduledTime) {
        this.topic = topic;
        this.payload = payload;
        this.scheduledTime = scheduledTime;
    }

    public ConversionMessage(String topic, Object payload, int priority,Long id) {
        this.id = id;
        this.topic = topic;
        this.payload = payload;
        this.priority = priority;
    }

    public void incrementRetryCount() {
        this.retryCount++;
    }

    private String topic;
    private Object payload;
    private LocalDateTime createdAt;
    private int priority;
    private MessageStatus status;
    private int retryCount;
    private LocalDateTime scheduledTime;

    public enum MessageStatus {
        PENDING,
        PROCESSING,
        COMPLETED,
        FAILED
    }
}